package com.ruoyi.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.domain.entity.SysUser;
import com.ruoyi.domain.entity.SysUser;
import com.ruoyi.service.SysUserService;
import com.ruoyi.mapper.SysUserMapper;
import com.ruoyi.util.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

/**
* @author 86187
* @description 针对表【sys_user(用户信息表)】的数据库操作Service实现
* @createDate 2023-07-19 11:39:13
*/
@Service
public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser>
    implements SysUserService{
    @Autowired
    private SysUserMapper sysUserMapper;




    @Override
    public boolean verifyUser(String username, String password) {
        //根据username获取用户
        String info = sysUserMapper.checkUserPwd(username);
        //若找不到该用户 或者 用户密码错误则返回false
        if (StringUtils.isEmpty(info) || !SecurityUtils.matchesPassword(password,info))
        {
            return false;
        }
        return true;

    }

}




